import java.lang.reflect.Constructor;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: syyyy
 * Date: 2025-09-16
 * Time: 18:18
 */
public class Test {
    public static void reflectNewInstance() {
        try {
            Class<?> c1 = Class.forName("reflectdemo.Student");//这里的泛型填了问号，所以下面要强转

            Student student = (Student)c1.newInstance();

            System.out.println(student);


        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }

}
